<script>
	function isWechatBrowser() {
		var userAgent = navigator.userAgent.toLowerCase();
		if (userAgent.match(/micromessenger/i)) {
			return true;
		} else {
			return false;
		}
	};

	export default {
		data() {
			return {
				shareBase: {},
				userIdBase: '',
				longitude: '',
				latitude: '',
			}
		},
		onLaunch: function() {
			let token = xaoi.store('token')

			// #ifdef WEB
			let openid = uni.getStorageSync('openid')
			if (isWechatBrowser()) {
				if (!(token || openid)) {
					let redirect_uri = encodeURIComponent('__HOST____API____APP__/base/account/oauth?url=' +
						encodeURIComponent(btoa(window.location.href)))

					window.location.href =
						'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2812fd65492dc929&redirect_uri=' +
						redirect_uri + '&response_type=code&scope=snsapi_base&state=#wechat_redirect'
					return;
				}
			}
			if(!token) {
				uni.reLaunch({
					url: '/pages/user/account/login'
				})
			}
			// #endif
		},
		async onShow() {
			// this.getDeviceInfoBase();
		},
		onHide: function() {

		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-plus/index.scss";
	@import './static/scss/base.scss';
	/*每个页面公共css */

	page {
		height: 100%;
		font-family: Arial, Helvetica, sans-serif;
	}

	.uni-tabbar__item {
		.uni-tabbar__icon.uni-tabbar__icon__diff {
			position: relative;
			top: 6rpx;
		}

		.uni-tabbar__label {
			font-size: 28rpx;
		}
	}

	image {
		height: auto;
		width: auto;
	}
</style>